home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…stman Always Clicks Twice / ADC Developer CD (1993-01) (''The Postman Always Clicks Twice'')_iso / Dev.CD 199301.iso / Tools & Apps / Misc. Utilities / Installer 3.4 / Examples - Installer 3.4 / Action Atom Samples / CustomFolderIconAA / CustomFoldIconInstall.r < prev    next >
Encoding:
Text File  |  1992-09-21  |  8.6 KB  |  226 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.4 sample: simple installation (Supports Easy and Custom Installation)
  6.  *
  7.  *    File:        CustomFoldIconInstall.r -    Rez Source
  8.  *    Description: Custom folder icons result when there is a file of name "Icon\n" in a
  9.  *                    folder, whose finder info flags have the "Use Custom Icon" bit set
  10.  *                    Additionally, the "Icon\n" file contains an 'icl4', 'icl8', 'ICN#,
  11.  *                    'ics#', 'ics4', and 'ics8' resource each with ID -16455.  Normally
  12.  *                    the icon file has the invisible bit set.  In this sample, the 
  13.  *                    Icon file is installed using an 'infa' file atom.  The invisible bit
  14.  *                    remains set during the install.  A post-installation action atom
  15.  *                    is then called being passed the resource ID of the 'infs' file
  16.  *                    spec for the target icon.  The code resource strips the file name
  17.  *                    and uses File Manager calls to get and set the Finder info for the 
  18.  *                    folder.
  19.  *
  20.  *    by:            Rich Kubota
  21.  *    modifications:
  22.  *                rrk - 9/8/92 updated the inaa resource to format1 from format0
  23.  *                        added the "continueBusyCursors" flag to the inaa.
  24.  *
  25.  *    Copyright © 1992 Apple Computer, Inc.
  26.  *    All rights reserved.
  27.  *
  28.  *------------------------------------------------------------------------------
  29.  *
  30.  * Install application "TeachText" into the folder "Root":Installed Application.
  31.  * It demonstrates how to implement a Custom Folder Icon.  
  32.  *----------------------------------------------------------------------------*/
  33.  
  34. #include "Types.r"                    /* for the ICON resource */
  35. #include "InstallerTypes.r"
  36.  
  37. /* You can build and complete the script with the following lines:
  38. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  39. # or set up folders with the same names and contents as the floppies
  40. # put these folders in the same folder as the script or at the root directory of same disk
  41.  
  42.     rez -o "CustomFoldIconInstall" -t 'bbkr' -c 'bbkr' "CustomFoldIconInstall.r"
  43.     setfile -a i "CustomFoldIconInstall"        #mark Inited
  44.     scriptcheck -p "CustomFoldIconInstall"
  45. */
  46.  
  47. /* put a 0 in the creation date field of source 'infs' to have ScriptCheck bypass date check */
  48. #define kScriptIgnoresDate    0x0
  49.  
  50. /* Definitions for the rules */
  51. #define rlInstallProgram        1000
  52.  
  53. /* Defines for the file spec atoms (specifications for source and destination files) */
  54. #define fsSourceProgram            2000
  55. #define fsTargetProgram            2001
  56. #define fsSourceIcon            2002
  57. #define fsTargetIcon            2003
  58.  
  59. /* This is the name of the source disk */
  60. #define ProgramDisk "Program Disk:"
  61.  
  62. /* where we want to install our file. */
  63. #define TargetPath    ":Installed Application:"
  64.  
  65. /* Definition for the package. */
  66. #define pkTheProgram            3000
  67.  
  68. /* Definition for the file atom */
  69. #define faProgram                4000
  70. #define faIcon                    4001
  71.  
  72. /* Definition for the package comment resource */
  73. #define cmtTheProgram            5000
  74.  
  75. /* Definitions for the action atom resources */
  76. #define aaSetFolderIcon            6000
  77.  
  78. /* 'inaa' code resource definition */
  79. #define        aaCodeID            10000
  80.  
  81. /* September 01, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  82. /* this value to a LongInt seconds value needed by the Installer. */
  83. #define currentReleaseDate        9011992        
  84. #define currentVersion            101     /* Version 1.0 goes in the 'icmt' rsrc */
  85.  
  86. #define iconTheProgram            5100
  87.  
  88. /************************** Easy Install Rule resources **********************************/
  89. resource 'infr' (1) {
  90.     format0  {{
  91.         pickFirst,    {rlInstallProgram},     /* Only one rule */
  92.     }};
  93. };
  94.  
  95. resource 'inrl' (rlInstallProgram) {
  96.     format0 {{
  97.         addUserDescription {"Click Install to install\n"},    /* message to appear in Easy Install screen */
  98.         addUserDescription {"The Program in custom folder\n"},    /* message to appear in Easy Install screen */
  99.         addPackages {{pkTheProgram}}            /* we're installing the program */
  100.     }};
  101. };
  102.  
  103. /***************************** Package Resources ************************************************/
  104. resource 'inpk' (pkTheProgram) {
  105.     format0 {
  106.         showsOnCustom,                 /* Package appears in the Custom Install display */
  107.         removable,                    /* Package can be removed */
  108.         dontForceRestart,            /* no need to reboot after live install */
  109.         cmtTheProgram,                 /* package's 'icmt' resource id */
  110.         0,                            /* Package size (filled in by ScriptCheck) */
  111.         "TheProgram", {                /* package name for package that shows on custom */
  112.             'infa', faProgram;
  113.             'infa', faIcon;
  114.             'inaa', aaSetFolderIcon;
  115.         }
  116.     }
  117. };
  118.  
  119. /***************************** Comments ************************************************/
  120. resource 'icmt' (cmtTheProgram) {
  121.     currentReleaseDate,
  122.     currentVersion,
  123.     iconTheProgram,
  124.     "This package installs TeachText in a folder with a custom icon. "
  125. };
  126.  
  127. resource 'ICON' (iconTheProgram) {
  128.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  129.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  130.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  131.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  132.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  133.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  134.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  135.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  136. };
  137.  
  138.  
  139. /********************************************* File Specs ******************************************/
  140. /* Source File Specs */
  141. resource 'infs' (fsSourceProgram) {
  142.     'APPL',                                /* File Type */
  143.     'ttxt',                                /* Creator */
  144.     kScriptIgnoresDate,                    /* ScriptCheck fills in the creation date */
  145.     noSearchForFile,                    /* Do not search the source disk for the file */
  146.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  147.     ProgramDisk"TeachText"                /* Path to the file */
  148. };
  149.  
  150. resource 'infs' (fsSourceIcon) {
  151.     '    ',                                /* File Type */
  152.     '    ',                                /* Creator */
  153.     kScriptIgnoresDate,                    /* ScriptCheck fills in the creation date */
  154.     noSearchForFile,                    /* Do not search the source disk for the file */
  155.     typeCrNeedNotMatch,                    /* file type and creator on source disk must match */
  156.     ProgramDisk"Icon Folder:Icon\n"        /* Path to the file */
  157. };
  158.  
  159. /* Target File Specs */
  160. resource 'infs' (fsTargetProgram) {
  161.     'APPL',                                /* File Type */
  162.     'ttxt',                                /* Creator */
  163.     0,                                    /* creation date not needed for target file specs */
  164.     noSearchForFile,                    /* Do not search the target disk for the file */
  165.     TypeCrMustMatch,                    /* not needed for target file specs */
  166.     TargetPath"TeachText"                /* destination Path */
  167. };
  168. resource 'infs' (fsTargetIcon) {
  169.     '    ',                                /* File Type */
  170.     '    ',                                /* Creator */
  171.     0,                                    /* creation date not needed for target file specs */
  172.     noSearchForFile,                    /* Do not search the target disk for the file */
  173.     typeCrNeedNotMatch,                    /* file type and creator on source disk must match */
  174.     TargetPath"Icon\n"                    /* destination Path */
  175. };
  176.  
  177. /******************************************** File Atoms ************************************************/
  178. resource 'infa' (faProgram) {
  179.     format0 {
  180.         deleteWhenRemoving,                /* Delete the file if remove (option-custom) is clicked    */
  181.         deleteWhenInstalling,             /* predelete the target before copying new one */
  182.         copy,                             /* Copy the file to the destination */
  183.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  184.         updateExisting,                 /* replace an existing copy, if mine is newer */
  185.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  186.         rsrcFork, dataFork,                /* Copy both forks of the file */
  187.         fsTargetProgram,                /* TARGET file spec for this file */
  188.         fsSourceProgram,                 /* SOURCE file spec for this file */
  189.         0,                                /* atom size (filled in by ScriptCheck) */
  190.         ""                                /* Atom Description (Installer will use file name) */
  191.     };
  192. };
  193.  
  194.  
  195. resource 'infa' (faIcon) {
  196.     format0 {
  197.         deleteWhenRemoving,                /* Delete the file if remove (option-custom) is clicked    */
  198.         deleteWhenInstalling,             /* predelete the target before copying new one */
  199.         copy,                             /* Copy the file to the destination */
  200.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  201.         updateExisting,                 /* replace an existing copy, if mine is newer */
  202.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  203.         rsrcFork, dataFork,                /* Copy both forks of the file */
  204.         fsTargetIcon,                    /* TARGET file spec for this file */
  205.         fsSourceIcon,                     /* SOURCE file spec for this file */
  206.         0,                                /* atom size (filled in by ScriptCheck) */
  207.         ""                                /* Atom Description (Installer will use file name) */
  208.     };
  209. };
  210.  
  211. resource 'inaa'    (aaSetFolderIcon) {
  212.     format1 {
  213.         continueBusyCursors,
  214.         actAfter,
  215.         dontActOnRemove,
  216.         actOnInstall,
  217.         'infn',
  218.         aaCodeID,
  219.         fsTargetIcon,                /* pass in the 'infs' resource ID of the target folder Icon file */
  220.         "Set Locked Bit of Target file based on target infs resource ID"
  221.     }
  222. };
  223.  
  224. INCLUDE    "SetFolderIcon.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes);
  225.  
  226.